Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cbieneman/rewrite out params new #4

Closed
wants to merge 99 commits into from

Conversation

llvm-beanz
Copy link
Owner

@llvm-beanz llvm-beanz commented Nov 1, 2023

Watch the world burn... yay!

This change rewrites `out` and `inout` parameters to be implemented on
the AST. The parameter copying behavior is modeled on the AST and
generated through codegen.

Instead of using the previously existing infrastructure for generating
HLSL's copy-in/copy-out semantaics, this change generates temporaries
based on the AST, uses AST-based analysis for optimziation, and uses
the Objective-C indirect writeback support for copy-out.
'cbieneman/rewrite-out-params' on '617b5097828'.
'cbieneman/rewrite-out-params' on '617b5097828'.
'cbieneman/rewrite-out-params' on '617b5097828'.
'cbieneman/rewrite-out-params' on '617b5097828'.
'cbieneman/rewrite-out-params' on '4cf0f6c6504'.
I need to clean up the lvalue bindings in CGF, but otherwise this is
going in the right direction.
SrcLV is Base with its casts stripped, but we only initialize it if we
have a writeback cast sequence, otherwise we can just use Base.
This handles SrcLV for non-simple values where the address might not be
available.
This change simplifies the casting chain for HLSL C-style casts that
are either derived to base conversions or casting an object to itself.
In both cases HLSL defines returning lvalues.

This change collapses the cast chains down. Before this change all the
CStyleCastExprs were genreated as `NoOp` casts with `ImplicitCastExpr`
cast chains leading up to them.

tools/clang/test/HLSLFileCheck/hlsl/classes/derived-to-base-casting.hlsl
This should all be done at the AST level
llvm-beanz and others added 29 commits October 19, 2023 10:35
Under the MSVC ABI arguments are emitted right to left, but writebacks
need to be emitted left to right for HLSL.

This is probably a case that we need to look into more.
If we have an unsized array we can't generate a temporary for it. That
makes unsized arrays as function parameters an odd special case that we
should fix.
The old test verified incorrect debug info based on incorrect code
generation. This test verifies correct debug info.

../tools/clang/test/HLSLFileCheck/dxil/debug/out_args.hlsl
This reverts commit 3307009.
../lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp
@llvm-beanz llvm-beanz closed this Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant